package hlhj.fhp.checkpoint

import android.annotation.SuppressLint
import android.os.Build
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import android.view.WindowManager

import com.example.mymvp.mvp.BaseMVP
import com.example.mymvp.mvp.BaseMvpAty
import com.example.mymvp.mvp.BasePresenter
import com.example.mymvp.mvp.BaseView
import com.gyf.barlibrary.ImmersionBar
import hlhj.fhp.checkpoint.customView.AndroidBug5497Workaround
import hlhj.fhp.checkpoint.utils.KeyboardUtil


/**
 * Created by Never Fear   on 2018\11\6 0006.
 * Never More....
 */

abstract class BaseAty<V : BaseView, P : BasePresenter<*, V>> : BaseMvpAty<V, P>() {

    protected abstract val contentId: Int
    @SuppressLint("MissingSuperCall")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(contentId)
        presenter!!.initView()
        presenter!!.setListener()
        presenter!!.logicStart()
        supportActionBar?.hide()
        ImmersionBar.with(this)
                .init()
        val headDv = findViewById<View>(R.id.headDv)
        if (headDv != null) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                headDv.visibility = View.GONE
            } else {
                headDv.visibility = View.VISIBLE
            }
        }

        findViewById<View>(R.id.btExit)?.let {
            it.setOnClickListener {
                KeyboardUtil.hideInput(this)
                finish()
            }
        }
    }

}
